import 'package:flutter/material.dart';
import 'app_theme_extension.dart';
import 'app_typography.dart';

/// 应用主题配置
/// 提供亮暗两套主题，包含主题扩展
class AppTheme {
  // 亮色主题
  static final ThemeData light = ThemeData.light().copyWith(
    brightness: Brightness.light,
    scaffoldBackgroundColor: const Color(0xFFF5F5F5),
    primaryColor: const Color(0xFF1976D2),
    cardTheme: CardThemeData(
      color: Colors.white,
      elevation: 2,
      margin: const EdgeInsets.all(8),
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(4)),
      ),
    ),
    appBarTheme: const AppBarTheme(
      color: Colors.white,
      elevation: 1,
      foregroundColor: Colors.black87,
      iconTheme: IconThemeData(color: Colors.black87),
    ),
    textTheme: AppTypography.createTextTheme(false),
    dividerTheme: const DividerThemeData(
      color: Color(0xFFE0E0E0),
      thickness: 1,
      space: 1,
    ),
    extensions: [AppThemeExtension.light],
  );
  
  // 暗色主题
  static final ThemeData dark = ThemeData.dark().copyWith(
    brightness: Brightness.dark,
    scaffoldBackgroundColor: const Color(0xFF121212),
    primaryColor: const Color(0xFF2196F3),
    cardTheme: CardThemeData(
      color: const Color(0xFF1E1E1E),
      elevation: 2,
      margin: const EdgeInsets.all(8),
      shape: const RoundedRectangleBorder(
        borderRadius: BorderRadius.all(Radius.circular(4)),
      ),
    ),
    appBarTheme: const AppBarTheme(
      color: Color(0xFF1E1E1E),
      elevation: 1,
      foregroundColor: Colors.white,
      iconTheme: IconThemeData(color: Colors.white),
    ),
    textTheme: AppTypography.createTextTheme(true),
    dividerTheme: const DividerThemeData(
      color: Color(0xFF424242),
      thickness: 1,
      space: 1,
    ),
    extensions: [AppThemeExtension.dark],
  );
  
  /// 获取主题扩展
  static AppThemeExtension extensionOf(BuildContext context) {
    return Theme.of(context).extension<AppThemeExtension>()!;
  }
} 